/**
 * @Author 12629
 * @Date 2022/4/6 20:44
 * @Description：
 */
class Animal {
    public String name;

    public Animal(String name) {
        this.name = name;
    }

    public void eat(){
        System.out.println(this.name+" 吃饭饭！");
    }

    //飞   跑   游泳 不能吧这些操作 写到这里面

}

interface IFlying {
    void fly();
}

interface IRunning {
    void run();
}

interface ISwimming {
    void swim();
}

class Cat extends Animal implements IRunning{

    public Cat(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println(this.name+" is cat 正在跑！");
    }
}
//
class Dog extends Animal implements IRunning,ISwimming{

    public Dog(String name) {
        super(name);
    }


    @Override
    public void run() {
        System.out.println(this.name+" is dog 正在跑！");
    }

    @Override
    public void swim() {
        System.out.println(this.name+" 正在游泳！");
    }
}

class Robot implements IRunning{

    @Override
    public void run() {
        System.out.println("我是机器人，我再跑！");
    }
}

class Duck extends Animal implements IRunning,ISwimming,IFlying {

    public Duck(String name) {
        super(name);
    }

    @Override
    public void fly() {
        System.out.println(this.name+" 烤鸭正在飞！");
    }

    @Override
    public void run() {
        System.out.println(this.name+" 烤鸭正在跑！");
    }

    @Override
    public void swim() {
        System.out.println(this.name+" 烤鸭正在游泳！");
    }
}

public class Test2 {

    public static void walk(IRunning iRunning) {
        iRunning.run();
    }

    public static void swim(ISwimming iSwimming) {
        iSwimming.swim();
    }

    public static void fly(IFlying iFlying) {
        iFlying.fly();
    }

    public static void main1(String[] args) {
        //swim(new Dog("小狗"));
        Duck duck = new Duck("唐老鸭");
        swim(duck);
        walk(duck);
        fly(duck);
    }

    public static void main2(String[] args) {

        Dog dog = new Dog("哈哈");
        walk(dog);
        walk(new Dog("mimi2"));
        walk(new Cat("mimi1"));
        walk(new Robot());
    }
    public static void main(String[] args) {
        Animal animal = new Cat("mimi");
        Animal animal2 = new Dog("mimi2");


        IRunning iRunning = new Dog("mimi2");
        ISwimming swimming = new Dog("mimi2");

        IRunning iRunning2 = new Cat("mimi");


    }
}